<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 400px;
            position: absolute;
        }

        .box1 {
            background: red;
            /* 修改元素层级关系 值越大置于顶层*/
            z-index: 1;
        }

        .box2 {
            background: blue;
            /* z-index: 2; */
        }
    </style>
</head>

<body>
    <div class="box1"></div>
    <div class="box2"></div>
</body>

</html>